package com.fandy.struts.SqlStatement;

public class OrderDetail {
 
	public   String  getAll()
	{
		return   "select * from OrderDetail";
	}
	
	public   String getOrderDetailByID(int ID)
	{
		return  "select * from OrderDetail where " +com.fandy.struts.Meta.OrderDetail.getOrderid()+"="+ID;
	}
	
	
	public String Add(com.fandy.struts.Model.OrderDetail od)
	{
		
		return "insert into OrderDetail values ("
		+ "'" + od.getGoodsid()+"',"		 
		+ "'" +od.getOrderid()+"',"
		+ "'"  + od.getPrice() + "',"
		+ "'"  + od.getQuantity() + "',"
		+")"
		;
		
	}
	
	
	public   String  existOrder(com.fandy.struts.Model.OrderDetail od)
	{
		return  "select count(*) from OrderDetail where " +com.fandy.struts.Meta.OrderDetail.getOrderid()+  "= '"
		+od.getOrderid()
		+ "'";
	}
	
	public String UpdateByID(int OrderID,com.fandy.struts.Model.OrderDetail od)
	{
		
		return "update GoodsInfo set "+com.fandy.struts.Meta.OrderDetail.getGoodsid()
		+"='" + od.getGoodsid()+"',"		 
		+com.fandy.struts.Meta.OrderDetail.getOrderid()+"='" +od.getOrderid()+"',"
		+com.fandy.struts.Meta.OrderDetail.getPrice()+ "='"  + od.getPrice() + "',"
		+com.fandy.struts.Meta.OrderDetail.getQuantity()+ "='"  + od.getQuantity() + "',"
		+"where "+com.fandy.struts.Meta.OrderDetail.getOrderid()+"="+OrderID;
		
	}
	
	public String DeleteByID(int id)
	{
		
		return "delete from OrderDetail where " + com.fandy.struts.Meta.OrderDetail.getOrderid() +"="+id;
		
	}
	
	
	
}

